package wechat.handler.resources.app;

import wechat.handler.resources.InstanceResource;
import wechat.handler.util.aes.AesException;
import wechat.handler.util.aes.WXBizMsgCrypt;

/**
 * wechat app2
 *
 */
public class AppID2 extends InstanceResource {
	
	private static final String PREFIX = "AppID2";

	private static final String BaseURL = "https://www.exam.com";
	
	private static final String RedirectURI = "https%3A%2F%2Fweixin.exam.com%2FWechatWeb%2FServiceServlet%2F" + PREFIX;
	private static String Auth = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri="+RedirectURI+"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
		
	private static String appid = INS.getValue(PREFIX +"." + APPID);
	private static String appsecret = INS.getValue(PREFIX +"." + APPSECRET);
	private static String token = INS.getValue(PREFIX +"." + TOKEN);
	private static String encodingAESKey = INS.getValue(PREFIX +"." + ENCODINGAESKEY);
	private static String wechatid = INS.getValue(PREFIX +"." + WECHATID);
	private String auth = Auth;
	
	private WXBizMsgCrypt wxBizMsgCrypt;
	
	private static String Pay_Template_Id = "x2GkFCV3iwlBtoaWmhl743aByTEhX4eZ-01Frfxtd2c";
	private static String Verify_Template_Id = "ec6P35S9fx8_OKTYzYeWfEBypssZzNnCzFMyWSpbRRY";
	private static String Bind_Template_Id = "NXalN7zZTwhtLtgopxGLeJt9ek0IvT7h8t8nA4d-2eI";


	/**
	 * 订单查询
	 */
	private static String OrderSeach = BaseURL + "/CenterServiceServlet/" + appid + "?state=10";
	/**
	 * 交易日报
	 */
	private static String DailyTrading = BaseURL + "/CenterServiceServlet/" + appid + "?state=11";
	/**
	 * 我的返利
	 */
	private static String UserRebate = BaseURL + "/CenterServiceServlet/" + appid + "?state=20";
	/**
	 * 我要分享
	 */
	private static String UserShare = BaseURL + "/CenterServiceServlet/" + appid + "?state=21";
	/**
	 * 我的收款码
	 */
	private static String UserQRCode = BaseURL + "/CenterServiceServlet/" + appid + "?state=30";
	/**
	 * 我的信息
	 */
	private static String UserInfo = BaseURL + "/CenterServiceServlet/" + appid + "?state=31";
	/**
	 * 代理管理
	 */
	private static String AgentManagement = BaseURL + "/CenterServiceServlet/" + appid + "?state=32";
	/**
	 * 注册
	 */
	private static String UserRegister = BaseURL + "/CenterServiceServlet/" + appid + "?state=40";
	/**
	 * 登录
	 */
	private static String UserLogin = BaseURL + "/CenterServiceServlet/" + appid + "?state=41";
	/**
	 * 使用指南(初始消息)
	 */
	private static String OperatingGuide = BaseURL + "/CenterServiceServlet/" + appid + "?state=42";
	/**
	 * 收款码绑定
	 */
	private static String QRCodeBinding = BaseURL + "/CenterServiceServlet/" + appid + "?state=43";
	/**
	 * 资料修改
	 */
	private static String UserUpdate = BaseURL + "/CenterServiceServlet/" + appid + "?state=44";
	/**
	 * 使用指南(回复消息)
	 */
	private static String OperatingGuideImmediately = BaseURL + "/CenterServiceServlet/" + appid + "?state=45";
	/**
	 * 收银员管理
	 */
	private static String CashierManagement = BaseURL + "/CenterServiceServlet/" + appid + "?state=34";

	
	public static final String Subscribe_Content = "亲,您终于来了，我们已经恭候您多时了!\n\n" 
            + "未注册,猛戳【<a href='"+UserRegister+"'>马上开通</a>】\n"
			+ "\n"
			+ "已注册,点击【<a href='"+UserLogin+"'>我要登录</a>】 \n"
			+ "\n" 
			+ "如需帮助,点击【<a href='"+OperatingGuide+"'>使用指南</a>】 或服务号内直接提问哦!";
	
	//public static final String Common_Content = "您好有问题请直接咨询客服，客服电话：4000-365-724";
	public static final String Common_Content = "您好，感谢你的使用！\n"
			+ "*资料修改\n"
			+ "【<a href='"+UserUpdate+"'>点击这里，立即修改</a>】\n"
			+ "*使用指南\n"
			+ "【<a href='"+OperatingGuideImmediately+"'>点击这里，立即查看</a>】\n"
			+ "如需人工帮助，请拨打客服电话4000-365-724，我们将努力为您服务！！";

	
	public AppID2(){

	}

	

	@Override
	public String getAppid() {
		return appid;
	}

	@Override
	public String getAppsecret() {
		return appsecret;
	}

	@Override
	public String getToken() {
		return token;
	}

	@Override
	public String getEncodingAESKey() {
		return encodingAESKey;
	}

	@Override
	public String getWechatid() {
		return wechatid;
	}

	@Override
	public String getAuth() {
		return auth;
	}

	
	@Override
	public String getOrderSeach() {
		return OrderSeach;
	}

	@Override
	public String getDailyTrading() {
		return DailyTrading;
	}

	@Override
	public String getUserRebate() {
		return UserRebate;
	}

	@Override
	public String getUserShare() {
		return UserShare;
	}

	@Override
	public String getUserQRCode() {
		return UserQRCode;
	}

	@Override
	public String getUserInfo() {
		return UserInfo;
	}

	@Override
	public String getAgentManagement() {
		return AgentManagement;
	}

	@Override
	public String getUserRegister() {
		return UserRegister;
	}

	@Override
	public String getUserLogin() {
		return UserLogin;
	}

	@Override
	public String getOperatingGuide() {
		return OperatingGuide;
	}

	@Override
	public String getQRCodeBinding() {
		return QRCodeBinding;
	}

	@Override
	public String getUserUpdate() {
		return UserUpdate;
	}

	@Override
	public String getOperatingGuideImmediately() {
		return OperatingGuideImmediately;
	}

	@Override
	public String getCashierManagement() {
		return CashierManagement;
	}

	@Override
	public String getPayTemplateId() {
		return Pay_Template_Id;
	}

	@Override
	public String getVerifyTemplateId() {
		return Verify_Template_Id;
	}

	@Override
	public String getBindTemplateId() {
		return Bind_Template_Id;
	}
	
	@Override
	public String getSubscribeContent() {
		return Subscribe_Content;
	}

	@Override
	public String getCommonContent() {
		return Common_Content;
	}
	
	@Override
	public WXBizMsgCrypt getWXBizMsgCrypt() throws AesException {
		if (wxBizMsgCrypt == null) {
			wxBizMsgCrypt = new WXBizMsgCrypt(getToken(), getEncodingAESKey(), getAppid());
		}
		return wxBizMsgCrypt;
	}
	
}
